import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const doneState = 'el-button el-button--success is-round'
const undoState = 'el-button el-button--info is-round'

export default new Vuex.Store({
  state: {
    execState: 0,
    execList: [],
    currentState1: undoState,
    currentState2: undoState,
    currentState3: undoState,
    currentState4: undoState
  },
  getters: {

  },
  mutations: {
    setExecState (state, execNo) {
      // switch (execNo) {
      //   case 1:
      //     state.currentState1 = doneState
      //     state.currentState2 = undoState
      //     state.currentState3 = undoState
      //     state.currentState4 = undoState
      //         break;
      //   case 2:
      //     state.currentState1 = doneState
      //     state.currentState2 = doneState
      //     state.currentState3 = undoState
      //     state.currentState4 = undoState
      //         break;
      //   case 3:
      //     state.currentState1 = doneState
      //     state.currentState2 = doneState
      //     state.currentState3 = doneState
      //     state.currentState4 = undoState
      //         break;
      //   case 4:
      //     state.currentState1 = doneState
      //     state.currentState2 = doneState
      //     state.currentState3 = doneState
      //     state.currentState4 = doneState
      //     break;
      // }
      let tmp = 0;
      for (let i = 1; i <= execNo; i++) {
        state['currentState' + i] = doneState
        tmp = i;
      }
      for (tmp++; tmp <= 4; tmp++) {
        state['currentState' + tmp] = undoState
      }
    }
  },
  actions: {

  }
})
